Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notice when app engine java components aren't installed #207

Closed
wants to merge 16 commits into from
Closed

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Sep 8, 2016

@meltsufin @joaoandremartins @etanshaul @markpell

fix #165

Uses gcloud components list

@@ -262,11 +290,20 @@ public void validate() throws AppEngineException {
"Validation Error: Java Tools jar location '"
+ JAR_LOCATIONS.get(JAVA_TOOLS_JAR) + "' is not a file.");
}
try {
if (!isComponentInstalled("app-engine-java")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the block above that checks the existence of JAVA_TOOLS_JAR sufficient to tell if the component is installed? I'm still not a fan of doing this expensive check using gcloud components list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 to @meltsufin's comment: I tried running gcloud from a VM shared drive and it was glacially sloooow. If JAVA_TOOLS_JAR (or one of the jars) isn't available then we're either dealing with a missing app-engine-java component, or appengine-plugins-core is out of sync with the installed version and

Copy link
Member

@briandealwis briandealwis Sep 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use JAVA_TOOLS_JAR as a heuristic: if the path exists, then we seem to have app-engine-java installed, otherwise confirm with gcloud components list.

(or better yet, …/.install/app-engine-java.manifest, since that's most specific.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried running gcloud components remove app-engine-java on my Linux machine and it did delete ~/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/lib/appengine-tools-api.jar. When installed it back using gcloud components install app-engine-java, it reappeared. So, I think checking for existence of JAVA_TOOLS_JAR is sufficient.
@elharo, do you see a different result when you run these commands?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The practice of depending on the Cloud SDKs internal directory structure is not OK with the Cloud SDK team. They reserve the right to break this at their discretion. We need to move away from depending on incidental files distributed with the SDK and moving to using their api/cli for this check is part of that.

This is also why we're moving to using Maven central as the source for classpath deps.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that the Cloud SDK reserves the right to move the files, but until we drop the dependency on AppCfg in the app-engine-java component in the Cloud SDK, we can do the file-based check without making anything more fragile in the library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Staging is in the process of being distributed to Maven Central. We should
be extracting ourselves out of this mess, rather than digging deeper into
it.

On Thu, Sep 8, 2016 at 12:46 PM, meltsufin [email protected] wrote:

In src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdk.java
#207 (comment)
:

@@ -262,11 +290,20 @@ public void validate() throws AppEngineException {
"Validation Error: Java Tools jar location '"
+ JAR_LOCATIONS.get(JAVA_TOOLS_JAR) + "' is not a file.");
}

  • try {
  •  if (!isComponentInstalled("app-engine-java")) {
    

It's true that the Cloud SDK reserves the right to move the files, but
until we drop the dependency on AppCfg in the app-engine-java component in
the Cloud SDK, we can do the file-based check without making anything more
fragile in the library.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/GoogleCloudPlatform/appengine-plugins-core/pull/207/files/29147b0c66ac9c154d990808acfebec1ffc8f716#r78044155,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHf5HRitzbZ-DsADGWSLzsSPa2aR3TLxks5qoDvvgaJpZM4J35Q-
.


private CloudSdk(Path sdkPath,
String appCommandMetricsEnvironment,
String appCommandMetricsEnvironmentVersion,
@Nullable File appCommandCredentialFile,
String appCommandOutputFormat,
ProcessRunner processRunner,
WaitingProcessOutputLineListener runDevAppServerWaitListener) {
WaitingProcessOutputLineListener outputLineListener,
AccumulatingLineListener stdOutput) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need two kinds of listener API's? It seems unlikely the user would want to pass both?

Copy link
Contributor Author

@elharo elharo Sep 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They do quite different things. It might make sense to move the AccumulatingLineListener into ProcessRunner itself. It's not exposed in the public API (constructor is private)

@@ -93,6 +93,11 @@
<artifactId>jsr305</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sort of half read the other json related thread you have going. Are we switching this to gson?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. GSON would be dramatic overkill for reading a single value. We could use JSR 353 if the license (GPL, CDDL) isn't a problem.

@loosebazooka
Copy link
Contributor

I'm not fully sure what was discussed here, but we're already depending on the jar being in the directory. Adding a check doesn't change how we interact with it. Could we should just check the existence for now. Future options include using the published jar for staging in maven central or possibly via a staging command exposed in gcloud (maybe?)

@patflynn
Copy link
Contributor

patflynn commented Sep 9, 2016

This check though is for whether the java app engine component has been
installed. The contract for determining that through gcloud is by querying
the installed components through the CLI. Using a heuristic when we don't
need one doesn't seem like the right thing to do.

On Thu, Sep 8, 2016 at 6:13 PM, Appu Goundan [email protected]
wrote:

I'm not fully sure what was discussed here, but we're already depending on
the jar being in the directory. Adding a check doesn't change how we
interact with it. Could we should just check the existence for now. Future
options include using the published jar for staging in maven central or
possibly via a staging command exposed in gcloud (maybe?)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#207 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHf5HWVkPkAv8j4cb4czdEe0gfWMcKqHks5qoIh5gaJpZM4J35Q-
.

@meltsufin
Copy link
Member

When we move away from relying on the jar in the Cloud SDK, we should reevaluate the detection of the component as well. However, currently, there is no additional risk in using the existence of the jar as the marker for the component being installed.

@elharo
Copy link
Contributor Author

elharo commented Sep 9, 2016

There appears to be something really weird going on with the backup gcloud creates on removing the app-engine-java component, at least on Mac OS X. Somehow my terminal gets redirected to look there instead of where it used to be. That explains why Mike thinks the tools jar is removed and I think it isn't. It's actually being moved from point A to point B, and perhaps a link left behind.

@patflynn
Copy link
Contributor

@briandealwis
@elharo
@etanshaul
@meltsufin
@loosebazooka

After an offline discussion I've been convinced that checking the jar location is actually the best approach for now.

Getting this behavior into the library is blocking our IJ release (since we want this feature for our next beta). Anybody have bandwidth to start on this today?

@elharo elharo closed this Sep 12, 2016
@loosebazooka loosebazooka deleted the i165b branch April 4, 2017 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide more specific error when missing app-engine-java gcloud component
6 participants